package com.neu.af.dataFilter.service.piservice.Impl;


import com.neu.af.dataFilter.service.piservice.PiRead;
import com.neu.af.dataFilter.service.piservice.pireader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.ArrayList;
import java.util.List;

@Service
public class PiReadImpl implements PiRead {
    public static pireader pireaderdll;

    @Override
    public void test(){
        pireaderdll.test();
        System.out.println(Connect("10.72.128.41", "pidemo", "", 5450));
    }


    @Override
    public boolean Connect(String hostName,String uid,String pwd,int piPort){
        return pireaderdll.connect(hostName,uid,pwd,piPort);
    }

    @Override
    public String GetData(String tagName, String starttime,String separator){
        // List<String> res = new ArrayList<>();
        String res = pireaderdll.getHistoryDataFromPI(tagName,starttime,separator);
//        String[] reslist = list.split(separator);//分割符，
//        for (String item:reslist) {
//            res.add(item);
//        }
        return res;
    }

    @Override
    public boolean close() {
        return pireaderdll.close();
    }

    @Override
    public String getHistoryDataFromPI(String tagName, String startTime, String separator) {
        return pireaderdll. getHistoryDataFromPI(tagName,startTime, separator);
    }

    @Override
    public String getMultiHistoryDataFromPI(String tagName, String starttime, String separator) {
        return pireaderdll.getMultiHistoryDataFromPI(tagName, starttime, separator);
    }

    @Override
    public String getDescriptorFromPI(String tagNames, String seperator) {
        return pireaderdll.getDescriptorFromPI(tagNames, seperator);
    }

    @Override
    public String getSnapShotDataFromPI(String tagNames, String seperator) {
        return pireaderdll.getSnapShotDataFromPI(tagNames, seperator);
    }

//    @Override
//    public List<String> getAllHistoryDataFromPI(String startTime, String separator) {
//        return pireaderdll.getAllHistoryDataFromPI(startTime, separator);
//    }


}
